import { defineConfig } from 'vitepress';
import path from 'path';
import { mdPlugin } from './../plugins/markdownIt';
const resolve = dir => path.join(__dirname, dir);
const IS_PROD = () => {
	return process.argv[process.argv.length - 1] === 'build';
};
export default defineConfig({
	outDir: resolve('../../document'),
	base: IS_PROD() ? '/q-admin-design-vue/document/' : '/',
	title: '组件文档',
	description: '组件文档',
	head: [
		['link', { rel: 'icon', type: 'image/svg+xml', href: 'images/logo.svg' }],
	],
	lastUpdated: true,
	markdown: {
		theme: 'material-palenight',
		lineNumbers: false,
		config: md => mdPlugin(md),
	},
	themeConfig: {
		lastUpdatedText: '上次更新',
		logo: 'images/logo.svg',
		nav: [
			{ text: '主页', link: '/' },
			{ text: '指南', link: '/pages/install' },
			{ text: '更新日志', link: '/pages/updateLog' },
		],

		sidebar: [
			{
				text: '开发指南',
				collapsible: true,
				items: [
					{
						text: '安装',
						link: '/pages/install',
					},
					{
						text: '快速开始',
						link: '/pages/quickstart',
					},
				],
			},
			{
				text: '功能组件',
				collapsible: true,
				items: [
					{
						text: 'checkbox多选 选择器',
						link: '/pages/q-multiple-select-check-box',
					},
				],
			},
			{
				text: '列表组件',
				collapsible: true,
				items: [
					{
						text: '表单组件',
						link: '/pages/form',
					},
					{
						text: '弹框表单组件',
						link: '/pages/dialog-form',
					},
					{
						text: '列表查询组件',
						link: '/pages/q-search',
					},
					{
						text: '列表组件',
						link: '/pages/q-table',
					}
				],
			},
			{
				text: '弹窗类组件',
				collapsible: true,
				items: [
					{
						text: '弹窗组件',
						link: '/pages/dialog',
					},
					{
						text: '确认弹窗组件',
						link: '/pages/q-icon-confirm',
					},
					{
						text: '确认弹窗组件(无icon)',
						link: '/pages/q-confirm',
					},
				],
			},
			{
				text: '图片类组件',
				collapsible: true,
				items: [
					{
						text: 'Upload 上传',
						link: '/pages/q-upload',
					},
					{
						text: 'Svga 图片',
						link: '/pages/q-svga',
					},
					{
						text: 'Image 图片',
						link: '/pages/q-image',
					},
					{
						text: 'ImagePreview 图片',
						link: '/pages/q-image-preview',
					}
				],
			},
		],
	},
});
